package com.lagou.demo.controller;

import com.lagou.demo.service.IDemoService;
import com.lagou.edu.mvcframework.annotations.LagouAutowired;
import com.lagou.edu.mvcframework.annotations.LagouController;
import com.lagou.edu.mvcframework.annotations.LagouRequestMapping;
import com.lagou.edu.mvcframework.annotations.Security;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@LagouController
@LagouRequestMapping("/demo")
@Security({"teacher", "lagou"})
public class DemoController {


    @LagouAutowired
    private IDemoService demoService;


    /**
     * URL: /demo/handle01?name=lisi
     *
     * @param request
     * @param response
     * @param username
     * @return
     */
    @LagouRequestMapping("/handle01")
    @Security({"hym", "student01"})
    public void handle01(HttpServletRequest request, HttpServletResponse response, String username) throws IOException {
        response.getWriter().println("hello " + demoService.get(username));
    }

}
